/* ---------------------------------------------------------------------- */
/* Add tables                                                             */
/* ---------------------------------------------------------------------- */

/* ---------------------------------------------------------------------- */
/* Add table "dezrepo_permissions"                                        */
/* ---------------------------------------------------------------------- */

CREATE TABLE dezrepo_permissions (
    prm_username VARCHAR2(50) NOT NULL,
    prm_projectfilename VARCHAR2(250) NOT NULL,
    permission VARCHAR2(50),
    PRIMARY KEY (prm_username, prm_projectfilename)
);

/* ---------------------------------------------------------------------- */
/* Add table "dezrepo_projects"                                           */
/* ---------------------------------------------------------------------- */

CREATE TABLE dezrepo_projects (
    projectfilename VARCHAR2(250) NOT NULL,
    projectname VARCHAR2(250) NOT NULL,
    projectdescription VARCHAR2(250),
    latestversion NUMBER,
    lockedby VARCHAR2(50),
    lockeddate VARCHAR2(20),
    lastupdateby VARCHAR2(50),
    lastupdatedate VARCHAR2(20),
    dezignversionnumber VARCHAR2(10),
    PRIMARY KEY (projectfilename)
);

/* ---------------------------------------------------------------------- */
/* Add table "dezrepo_projectversions"                                    */
/* ---------------------------------------------------------------------- */

CREATE TABLE dezrepo_projectversions (
    prv_projectfilename VARCHAR2(250) NOT NULL,
    versionnumber NUMBER NOT NULL,
    commitdate VARCHAR2(20),
    prv_username VARCHAR2(50),
    projectdata BLOB,
    changecomment VARCHAR2(250),
    dezignversionnumber VARCHAR2(10),
    PRIMARY KEY (prv_projectfilename, versionnumber)
);

/* ---------------------------------------------------------------------- */
/* Add table "dezrepo_settings"                                           */
/* ---------------------------------------------------------------------- */

CREATE TABLE dezrepo_settings (
    settingname VARCHAR2(30) NOT NULL,
    settingvalue VARCHAR2(100),
    PRIMARY KEY (settingname)
);

/* ---------------------------------------------------------------------- */
/* Add table "dezrepo_users"                                              */
/* ---------------------------------------------------------------------- */

CREATE TABLE dezrepo_users (
    username VARCHAR2(50) NOT NULL,
    userpassword VARCHAR2(50),
    lastlogindate VARCHAR2(20),
    userrights VARCHAR2(100),
    defaultpermission VARCHAR2(20),
    PRIMARY KEY (username)
);
